package com.wing.enterprise.sell.model.response;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wing.enterprise.sell.model.entity.Order;
import com.wing.enterprise.sell.model.entity.OrderPro;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;


/**
 * 销售订单表VO
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class OrderVO {

    /**
     * ID
     */
    private Long id;

    /**
     * 添加时间
     */
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime createTime;

    /**
     * 添加人
     */
    private String creatorName;
    /**
     * 订单编号
     */
    private String code;
    /**
     * 客户ID
     */
    private Long customerId;
    /**
     * 客户公司名称
     */
    private String customerName;
    /**
     * 客户联系人名称
     */
    private String customerContactsName;
    /**
     * 客户联系人电话
     */
    private String customerContactsPhone;

    /**
     * 产品数量
     */
    private Integer proQuantity;
    /**
     * 交货时间
     */
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime deliveryTime;
    /**
     * 所属渠道ID
     */
    private Long channelId;
    /**
     * 所属渠道名称
     */
    private String channelName;

    /**
     * 所属合同ID
     */
    private Long contractId;

    /**
     * 询价审核人ID
     */
    private Long checkerId;
    /**
     * 询价审核人名称
     */
    private String checkerName;
    /**
     * 报价截止时间
     */
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime offerEndTime;

    /**
     * 订单总金额
     */
    private BigDecimal amount;
    /**
     * 需求数
     */
    private Integer demandQuantity;
    /**
     * 订单类型
     */
    private Order.OrderType orderType;

    /**
     * 订单类型描述
     */
    @TableField(exist = false)
    private String orderTypeDesc;

    public String getOrderTypeDesc() {
        return orderType.getDesc();
    }

    /**
     * 订单状态
     */
    private Order.Status status;

    /**
     * 订单状态描述
     */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status.getDesc();
    }

    /**
     * 订单来源
     */
    private Order.OrderSource orderSource;

    /**
     * 订单来源描述
     */
    @TableField(exist = false)
    private String orderSourceDesc;

    public String getOrderSourceDesc() {
        return orderSource.getDesc();
    }

    /** 订单包含的产品
     */
    private List<OrderPro> orderProList = new ArrayList<OrderPro>();

    private String remark;

    /**
     * 合同名称
     */
    private String contractName;

}
